home *** CD-ROM | disk | FTP | other *** search
/ MacAddict 100 / MacAddict_100_2004_12.iso / mac / Files from the Print Side / Script Folder Actions / sample_script.txt < prev   
Text File  |  2004-10-06  |  2KB  |  42 lines

  1. on adding folder items to this_folder after receiving these_items
  2.  
  3. tell application "Finder"
  4. tell application "Finder"
  5. set the_date to current date
  6. set wd to weekday of the_date as string
  7. set m to month of the_date as string
  8. set d to day of the_date as string
  9. set ts to time of the_date as string
  10. set sent_folder to wd & m & d & "-" & ts as string
  11. end tell
  12. if not (exists folder sent_folder of folder "Desktop" of home) then
  13. make new folder at folder "Desktop" of home with properties {name:sent_folder}
  14. end if
  15. set the destination_folder to folder sent_folder of folder "Desktop" of home as alias
  16. set the destination_directory to POSIX path of the destination_folder
  17. end tell
  18. repeat with i from 1 to number of items in these_items
  19. set this_item to item i of these_items
  20. set the item_info to info for this_item
  21. if this_item is not the destination_folder and the name extension of the item_info is not in {"zip", "sit"} then
  22. set the item_path to the quoted form of the POSIX path of this_item
  23. set the destination_path to the quoted form of (destination_directory & (name of the item_info) & ".zip")
  24. do shell script ("/usr/bin/ditto -c -k -rsrc --keepParent " & item_path & " " & destination_path)
  25. end if
  26. end repeat
  27. tell application "Finder"
  28. tell application "Mail"
  29. activate
  30. set newmessage to make new outgoing message at beginning of outgoing messages
  31. tell content of newmessage
  32. make attachment at end of attachments with properties {file name:destination_directory}
  33. set visible of newmessage to true
  34. end tell
  35. end tell
  36. tell application "Finder"
  37. move folder sent_folder of folder "Desktop" of home to trash
  38. end tell
  39. end tell
  40.     
  41. end adding folder items to
  42.